import request from '@/http/request';

const getMembers = () => {
    return request({
        url: '/member/list',
        method: 'get'
    })
}

const getMemberById = (id) => {
    return request({
        url: '/member/searchbyid',
        method: 'get',
        params:{
            id: id
        }
    })
}

const getMemberByName = (name) => {
    return request({
        url: '/member/search',
        method: 'get',
        params:{
            name: name
        }
    })
}

const addMember = (member) => {
    return request({
        url: '/member/add',
        method: 'post',
        data: member
    })
}

const editMember = (member) => {
    return request({
        url: '/member/update',
        method: 'put',
        data: member
    })
}

const deleteMember = (id) => {
    return request({
        url: '/member/delete/' + id,
        method: 'delete',
    })
}

export default {
    getMembers,
    getMemberById,
    getMemberByName,
    addMember,
    editMember,
    deleteMember
};
